package model.core;

import model.ability.PassiveSkill;
import utility.BidirectionalMap;

public class SkillsLibrary {
	private BidirectionalMap<String, PassiveSkill> library = new BidirectionalMap<String, PassiveSkill>();
	
	private static SkillsLibrary skillsLibrary = null;
	
	private SkillsLibrary(){
		
	}
	
	public static SkillsLibrary getInstance(){
		if (skillsLibrary == null){
			skillsLibrary = new SkillsLibrary();
		}
		return skillsLibrary;
	}
	
	public PassiveSkill getSkill(String name){
		try {
			return library.getFromSecondSet(name).clone();
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return library.getFromSecondSet(name);
	}
	
	public String getName(PassiveSkill skill){
		return library.getFromFirstSet(skill);
	}
	
	public void put(String name, PassiveSkill skill){
		library.put(name, skill);
	}
}
